package com.sixmac.dao;

import com.sixmac.entity.*;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2016/3/4 0004 下午 2:39.
 */
public interface AppUserDao extends JpaRepository<AppUser, Integer>, JpaSpecificationExecutor<AppUser> {

    @Query("select a from AppUser a where a.mobile = ?1 and a.password = ?2")
    public AppUser iLogin(String mobile, String password);

    @Query("select a from AppUser a where a.mobile = ?1")
    public AppUser iLogin(String mobile);

    @Query("select a from AppUser a where a.mobile = ?1")
    public AppUser iFindOneByMobile(String mobile);

    @Query("select a from SysUser a where a.account = ?1 and a.password = ?2")
    public SysUser sysUserLogin(String account, String password);

    @Query("select a from AppUser a where a.createTime > ?1")
    public List<AppUser> findListNew(Date oldDate);

    @Query("select a from AppUser a where a.status = 0 and a.mobile like ?1")
    public List<AppUser> findList(String mobile);
}